<?php
require_once ('../Inc/.httpaccess');

class CTables
{
    private $conn;
    private $query;
    private $value;
    private $the_values;

    public function __construct()
    {
        $this->conn = mysql_pconnect( SERVER,LOGIN, PASSWORD);
		 mysql_select_db(DATABASE, $this->conn);
    } // __construct()

    public function __destruct()
    {
        mysql_close($this->conn);

    } // __destruct()

    public function Get_value() { return $this->value; }
    public function Get_the_values() { return $this->the_values; }
	
    public function Set_query($_query) { $this->query = $_query; }

    public function Select()
    {
        unset($this->value);
        $result = mysql_query($this->query) or die('Erreur SQL !'.$sql.'
'.mysql_error());
        $this->value = mysql_fetch_array($result, MYSQL_BOTH);
		
        return;

    } // Select()

    public function Select_all()
    {
        unset($this->the_values);
        $result = mysql_query($this->query)or die('Erreur SQL !'.$sql.'
'.mysql_error());
      
        $i=0;
        while ($row = mysql_fetch_array($result, MYSQL_BOTH))
            $this->the_values[$i++] = $row;

        return $i;

    } // Select_all()


    public function Modify()
    {
       $result = mysql_query($this->query) or die('Erreur SQL !'.$sql.'
'.mysql_error()); 
    } // Modify()

}; // class CTables

?>
